package com.csp.app.service;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.csp.app.client.ServiceClient;
import com.csp.app.entity.Course;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service

public class CourseService{
    @Autowired
    private ServiceClient serviceClient;
    /**
     * 查询所有课程
     * @return
     */
    public List<Course> searchAll(){
        return serviceClient.searchAllCourse();
    }

    /**
     * 批量添加课程
     * @param courses
     * @return
     */
    public boolean batchAdd(List<Course> courses){
        return serviceClient.batchAddCourse(courses);
    }

    public Course getEntityFromCacheByKey(String key){
        return serviceClient.getCourseFromCacheByKey(key);
    }

    public List<Course> selectList(EntityWrapper<Course> wrapper) {
        return serviceClient.selectCourseList(wrapper);
    }

    public boolean insert(Course course) {
        return serviceClient.insertCourse(course);
    }
}
